<script setup>
import { ElConfigProvider } from 'element-plus'
import { onMounted, onUnmounted } from 'vue'
import { userApi } from './services'

onMounted(() => {
  // 检查是否有refreshToken，如果有则启动定时刷新
  if (userApi.isLoggedIn()) {
    userApi.startTokenRefresh()
  }
})

onUnmounted(() => {
  // 组件卸载时停止刷新
  userApi.stopTokenRefresh()
})
</script>

<template>
  <el-config-provider>
    <router-view />
  </el-config-provider>
</template>

<style>
.dark {
  --el-bg-color: #1e1e1e;
  --el-bg-color-page: #141414;
  --el-text-color-primary: #ffffff;
  --el-border-color-light: #363636;
}
</style>
